﻿using Core.CSV;
using Game.WeaponComponent;

namespace Game {
    /// <summary>
    /// 双倍伤害效果
    /// </summary>
    public class DoubleDamageEffect : WeaponEffect {
        public DoubleDamageEffect(TBWeaponEffectConfig config) : base(config) { }
        
        protected override void onTrigger() {
            if (mAttachCombinant.Has<NormalMeleeAttackComponent>()) {
                mAttachCombinant.Get<NormalMeleeAttackComponent>().Damage *= 2;
            }

            if (mAttachCombinant.Has<NormalBulletSpawnerComponent>()) {
                mAttachCombinant.Get<NormalBulletSpawnerComponent>().Damage *= 2;   
            }
        }

        protected override void onTriggerEnd() {
            if (mAttachCombinant.Has<NormalBulletSpawnerComponent>()) {
                mAttachCombinant.Get<NormalBulletSpawnerComponent>().Damage /= 2;   
            }
        }
    }
}